php forum
php mysql forum
php mysql smarty
 
Topic Options
#277418 - 07/30/04 08:22 AM Finished-[6.3] Enable 'Badwords' Filtering For Member Profiles & User List
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
Mod Name / Version: Enable 'Badwords' Filtering For Member Profiles & User List <br /> <br />Description: This will enable badwords filtering in <br /> both a member's profile page & the user list in order to <br /> help prevent spamming (used to increase search engine rankings). <br /> <br />After you find a user who is engaging in spamming, simply <br /> add their spammed URL to your badwords filter list and all <br /> profiles & the user list will automatically censor it. <br /> <br />** IMPORTANT: The badwords URL MUST be in the format: www.example.com <br />DO NOT ADD HTTP:// to it. <br /> <br />NOTE: This is specifically for v6.3, and I'm not entirely <br /> sure if the changes will work correctly for newer versions, <br /> although I think they should. <br /> <br />(the 'FIND THIS:' sections may be a li'l <br /> different though, although that part will be easy to find <br /> anyway). <br /> <br />Feel free to post any updates in this thread for v6.4 & v6.5, if necessary. <br /> <br />Working Under: UBB.Threads 6.3 <br /> <br />Mod Status: Finished <br /> <br />Any pre-requisites: <br /> <br />Author(s): Twisty <br /> <br />Date: 07/30/04 <br /> <br />Credits: AllenAyres & Joshpet for initiating the idea <br /> <br />Files Altered: <br /> <br />showprofile.php <br />showmembers.php <br /> <br />New Files: <br /> <br />Database Altered: no <br /> <br />Info/Instructions: <br /> <br />[STEP 1] In showprofile.php... <br /> <br />FIND THIS: <br /> <br />
Code:
// ---------------- <br />// Assign the stuff <br />   list ($CheckUser,$Fakeemail,$Name,$Totalposts,$Homepage,$Occupation,$Hobbies,$Location,$Bio,$ICQ,$Extra2,$Extra3,$Extra4,$Extra5,$Registered,$Picture,$Title,$Userstatus,$UNumber,$Rating,$Rates,$width,$height,$coppauser,) = $dbh -&gt; fetch_array($sth); <br />   $dbh -&gt; finish_sth($sth);
<br /> <br />ADD AFTER IT, THIS: <br /> <br />
Code:
// --------------------------------------------------------------------- <br />// Substitute any filters/badwords with the $config[censored] variable <br />   $words[0] = ""; <br />   if ($config['censored']) { <br />      $badwords = @file("{$config['path']}/filters/badwords"); <br />      if (!is_array($badwords)) { <br />         $badwords = @file ("{$config['phpurl']}/filters/badwords"); <br />      } <br />      while (list($linenum,$line) = each($badwords) ) { <br />         $line = chop($line); <br />         if ( (preg_match("/^\r/",$line)) || (preg_match("/^\n/",$line)) ) { <br />            continue; <br />         } <br />         $islines = 1; <br />         $words[count($words)] = $line; <br />         // PHP4 ONLY <br />         // array_push ($words, $line); <br />      } <br />      if ($islines) { <br />         $badwords = join("|", $words); <br />         $badwords = preg_replace("/^\|/","",$badwords); <br /> <br />         $Homepage = preg_replace("/\b($badwords)\b/i",$config['censored'],$Homepage); <br />         $Fakeemail = preg_replace("/\b($badwords)\b/i",$config['censored'],$Fakeemail); <br />         $Name = preg_replace("/\b($badwords)\b/i",$config['censored'],$Name); <br />         $Occupation = preg_replace("/\b($badwords)\b/i",$config['censored'],$Occupation); <br />         $Hobbies = preg_replace("/\b($badwords)\b/i",$config['censored'],$Hobbies); <br />         $Location = preg_replace("/\b($badwords)\b/i",$config['censored'],$Location); <br />         $Bio = preg_replace("/\b($badwords)\b/i",$config['censored'],$Bio); <br />         $ICQ = preg_replace("/\b($badwords)\b/i",$config['censored'],$ICQ); <br />         $Extra2 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra2); <br />         $Extra3 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra3); <br />         $Extra4 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra4); <br />         $Extra5 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra5); <br />         $Title = preg_replace("/\b($badwords)\b/i",$config['censored'],$Title); <br />      } <br />   }
<br /> <br /> <br />[STEP 2] In showmembers.php... <br /> <br />FIND THIS: <br /> <br />
Code:
// ---------------------------------------------------------------- <br />// Cycle through the users <br />   for($i=0;$i&lt;$total;$i++){ <br /> <br />      list ($Username,$Reged,$ICQ,$Home,$Posts,$Status,$Uid) = $dbh -&gt; fetch_array($sth);
<br /> <br />ADD AFTER IT, THIS: <br /> <br />
Code:
// --------------------------------------------------------------------- <br />// Substitute any filters/badwords with the $config[censored] variable <br />   $words[0] = ""; <br />   if ($config['censored']) { <br />      $badwords = @file("{$config['path']}/filters/badwords"); <br />      if (!is_array($badwords)) { <br />         $badwords = @file ("{$config['phpurl']}/filters/badwords"); <br />      } <br />      while (list($linenum,$line) = each($badwords) ) { <br />         $line = chop($line); <br />         if ( (preg_match("/^\r/",$line)) || (preg_match("/^\n/",$line)) ) { <br />            continue; <br />         } <br />         $islines = 1; <br />         $words[count($words)] = $line; <br />         // PHP4 ONLY <br />         // array_push ($words, $line); <br />      } <br />      if ($islines) { <br />         $badwords = join("|", $words); <br />         $badwords = preg_replace("/^\|/","",$badwords); <br /> <br />         $Home = preg_replace("/\b($badwords)\b/i",$config['censored'],$Home); <br />         $ICQ = preg_replace("/\b($badwords)\b/i",$config['censored'],$ICQ); <br />      } <br />   }
<br /> <br /> <br />:-) <br /> <br />Disclaimer: Please backup every file that you intend to modify. <br />If the modification modifies the database, it's a good idea to backup your database before doing so. <br /> <br />Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/]
MAMEWorld

Top



Moderator:  Ian_W 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks